package kz.kstu.scantest.business.common.form.builder;

import kz.kstu.scantest.business.common.form.FormType;
import kz.kstu.scantest.business.entity.form.Form;

/**
 * @author Filipp_Stankevich
 *         created: 08.09.11 15:59
 */
public abstract class AbstractFormBuilder {

    public static Form createForm(FormType formType) {
        AbstractFormBuilder builder;
        if (FormType.DEFAULT.equals(formType)) {
           builder = new DefaultFormBuilder();
        } else {
            throw new IllegalArgumentException("Builder not supported. Builder name = " + formType);
        }
        Form form = new Form();
        builder.build(form);
        return form;
    }

    protected abstract void build(Form form);
}
